/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.testis.nicmodule.core;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;


/**
 *
 * @author nurhat
 */
public class NetworkInterfaceControllerFactory
{

    public static NetworkInterfaceController createInstance(String iModule,
                                                            String iFace)
        throws ClassNotFoundException, InstantiationException,
               IllegalAccessException, IllegalArgumentException,
               InvocationTargetException
    {
        Class<?> cls =
            Class.forName("org.testis.nicmodule.core." + iModule);
        Class partype[] = new Class[1];
        partype[0] = String.class;
        Constructor ctorlist[] = cls.getDeclaredConstructors();
        Constructor ct = ctorlist[0];
        NetworkInterfaceController tmpObject = (NetworkInterfaceController) ct.
            newInstance(iFace);
        return tmpObject;
    }
}
